//
// SoapTrace.Net - A soap message monitoring utility. 
//
// Copyright (C) 2006 Matthew Ward
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Matthew Ward (mrward@users.sourceforge.net)

using NUnit.Framework;
using SoapTrace.Core.Formatters;
using System;

namespace SoapTrace.Tests.Lines
{
	/// <summary>
	/// Tests the <see cref="LineCollection"/> class with a two lines that 
	/// use a carriage return and a new line character.
	/// </summary>
	[ TestFixture ]
	public class TwoCarriageReturnLinesTestFixture
	{
		LineCollection Lines;
		Line FirstLine;
		Line SecondLine;
		
		/// <summary>
		/// Initialises this test.
		/// </summary>
		[ SetUp ]
		public void Init( )
		{
			Lines = LineCollection.GetLines( "foo\r\nbar" );
			FirstLine = Lines[ 0 ];
			SecondLine = Lines[ 1 ];
		}
		
		/// <summary>
		/// Checks the line count,.
		/// </summary>
		[ Test ]
		public void LineCount( )
		{
			Assert.AreEqual( 2, Lines.Count, "Should be only two lines." );
		}
		
		/// <summary>
		/// Checks the first line's text
		/// </summary>
		[ Test ]
		public void FirstLineText( )
		{
			Assert.AreEqual( "foo", FirstLine.Text, "Incorrect first line text." );
		}
		
		/// <summary>
		/// Checks the first line's terminator is a new line.
		/// </summary>
		[ Test ]
		public void FirstLineTerminator( )
		{
			Assert.AreEqual( "\r\n", FirstLine.Terminator, "Terminator should be a newline." );
		}
		
		/// <summary>
		/// Checks the second line's text
		/// </summary>
		[ Test ]
		public void SecondLineText( )
		{
			Assert.AreEqual( "bar", SecondLine.Text, "Incorrect second line text." );
		}
		
		/// <summary>
		/// Check the second line's terminator is an empty string.
		/// </summary>
		[ Test ]
		public void SecondLineTerminator( )
		{
			Assert.AreEqual( String.Empty, SecondLine.Terminator, "Should be an empty string." );
		}
	}
}
